# $Id$
# Maintainer: Felix Yan <felixonmars@archlinux.org>

pkgbase=python-pyasn1-modules
pkgname=('python-pyasn1-modules' 'python2-pyasn1-modules')
pkgver=0.1.4
pkgrel=1
pkgdesc="A collection of ASN.1-based protocols modules"
arch=('any')
license=('BSD')
url="http://pypi.python.org/pypi/pyasn1-modules"
makedepends=('python-pyasn1' 'python2-pyasn1' 'python-setuptools' 'python2-setuptools')
source=("https://pypi.io/packages/source/p/pyasn1-modules/pyasn1-modules-$pkgver.tar.gz")
sha512sums=('29467aa9fff15b7a7ef999389db01fe696350e29910397f0c867685689a9fa8e5df8128a7703ae0de095804ae20c3759b24656467cec8d086d07a1014ccf5d65')

prepare() {
  cp -a pyasn1-modules-$pkgver{,-py2}
}

build() {
  cd "$srcdir"/pyasn1-modules-$pkgver
  python setup.py build

  cd "$srcdir"/pyasn1-modules-$pkgver-py2
  python2 setup.py build
}

check() {
  cd "$srcdir"/pyasn1-modules-$pkgver
  PYTHONPATH=. python tests/__main__.py

  cd "$srcdir"/pyasn1-modules-$pkgver-py2
  PYTHONPATH=. python2 tests/__main__.py
}

package_python-pyasn1-modules() {
  depends=('python-pyopenssl' 'python-pyasn1')

  cd pyasn1-modules-$pkgver
  python setup.py install --root="$pkgdir" --optimize=1 --skip-build
  install -Dm644 LICENSE.txt "$pkgdir"/usr/share/licenses/$pkgname/LICENSE.txt
}

package_python2-pyasn1-modules() {
  depends=('python2-pyopenssl' 'python2-pyasn1')

  cd pyasn1-modules-$pkgver-py2
  python2 setup.py install --root="$pkgdir" --optimize=1 --skip-build
  install -Dm644 LICENSE.txt "$pkgdir"/usr/share/licenses/$pkgname/LICENSE.txt
}
